package entity

import (
	"github.com/bytedance/sonic"
)

// ConditionParams 工作流条件参数
type ConditionParams map[string]any

func (c *ConditionParams) MarshalToString() (string, error) {
	if c == nil || len(*c) == 0 {
		return "{}", nil
	}

	b, err := sonic.Marshal(c)
	if err != nil {
		return "", err
	}

	return string(b), nil
}

func (c *ConditionParams) UnmarshalFromString(s string) error {
	return sonic.Unmarshal([]byte(s), c)
}
